import request from '@/utils/request'

// 查询应用菜单管理树结构
export function listTree(id, expandLevel) {
  if (id == null || id === '') {
    id = '0'
  }
  if (expandLevel == null || expandLevel === '') {
    expandLevel = '1'
  }
  return request({
    url: '/sys/appMenuResources/listTree/' + expandLevel + '/' + id,
    method: 'get'
  })
}

// 应用菜单管理树 搜索
export function searchAppMenu(searchInfo) {
  return request({
    url: '/sys/appMenuResources/searchAppMenuResources',
    method: 'get',
    params: searchInfo
  })
}

// 查询用户列表
export function listAppMenu (query) {
  return request({
    url: '/sys/appResources/list',
    method: 'get',
    params: query
  })
}

// 查询应用菜单管理列表
export function listAppMenuResources(query, id, expandLevel) {
  if (id == null || id === '') {
    id = '0'
  }
  if (expandLevel == null || expandLevel === '') {
    expandLevel = '1'
  }
  return request({
    url: '/sys/appMenuResources/list/' + expandLevel + '/' + id,
    method: 'get',
    params: query
  })
}

// 查询应用菜单管理树结构（排除当前节点及子节点）
export function listTreeExcludeChild(id, expandLevel) {
  return request({
    url: '/sys/appMenuResources/listTreeExcludeChild/' + expandLevel + '/0/' + id,
    method: 'get'
  })
}

// 查询应用菜单管理详细
export function getAppMenuResources(id) {
  return request({
    url: '/sys/appMenuResources/' + id,
    method: 'get'
  })
}

// 查询应用菜单管理下拉结构
export function treeGridSelect(id, expandLevel) {
  if (id == null || id === '') {
    id = '0'
  }
  if (expandLevel == null || expandLevel === '') {
    expandLevel = '1'
  }
  return request({
    url: '/system/menu/treeGridSelect/' + expandLevel + '/' + id,
    method: 'get'
  })
}

// 新增应用菜单管理
export function addAppMenuResources(data) {
  return request({
    url: '/sys/appMenuResources',
    method: 'post',
    data: data
  })
}

// 修改应用菜单管理
export function updateAppMenuResources(data) {
  return request({
    url: '/sys/appMenuResources',
    method: 'put',
    data: data
  })
}

// 删除应用菜单管理
export function delAppMenuResources(id) {
  return request({
    url: '/sys/appMenuResources/' + id,
    method: 'delete'
  })
}

// 查询最大编号
export function findMaxSort(parentId) {
  return request({
    url: '/sys/appMenuResources/findMaxSort/' + parentId,
    method: 'get'
  })
}

// 获取初始化数据
export function getInitData(dictTypes) {
  return request({
    url: '/sys/appMenuResources/getInitData/' + dictTypes,
    method: 'get'
  })
}

// 树表格检索
export function searchAppMenuResourcesList(searchInfo) {
  return request({
    url: '/sys/appMenuResources/searchAppMenuResourcesList',
    method: 'get',
    params: searchInfo
  })
}

// 树检索
export function searchAppMenuResources(searchInfo) {
  return request({
    url: '/sys/appMenuResources/searchAppMenuResources',
    method: 'get',
    params: searchInfo
  })
}

// 树列表
export function sysAppList(searchInfo) {
  return request({
    url: '/sys/appResources/sysApp/list',
    method: 'get',
    params: searchInfo
  })
}
